home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / pt-exp-base.h < prev    next >
C/C++ Source or Header  |  1997-05-26  |  2KB  |  112 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_tree_expr_h)
  24. #define octave_tree_expr_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include <string>
  31.  
  32. class octave_value;
  33.  
  34. #include "pt-base.h"
  35.  
  36. // A base class for expressions.
  37.  
  38. class
  39. tree_expression : public tree
  40. {
  41. public:
  42.  
  43.   enum type
  44.     {
  45.       unknown,
  46.       assignment,
  47.       simple_assignment,
  48.       multi_assignment,
  49.       colon,
  50.       index
  51.    };
  52.  
  53.   tree_expression (int l = -1, int c = -1, type et = unknown)
  54.     : tree (l, c), in_parens (0), etype (et) { }
  55.  
  56.   virtual ~tree_expression (void) { }
  57.  
  58.   virtual bool is_constant (void) const
  59.     { return false; }
  60.  
  61.   virtual bool is_matrix_constant (void) const
  62.     { return false; }
  63.  
  64.   virtual bool is_multi_val_ret_expression (void) const
  65.     { return false; }
  66.  
  67.   virtual bool is_identifier (void) const
  68.     { return false; }
  69.  
  70.   virtual bool is_indirect_ref (void) const
  71.     { return false; }
  72.  
  73.   virtual bool is_index_expression (void) const
  74.     { return false; }
  75.  
  76.   virtual bool is_assignment_expression (void) const
  77.     { return false; }
  78.  
  79.   virtual bool is_prefix_expression (void) const
  80.     { return false; }
  81.  
  82.   virtual bool is_logically_true (const char *);
  83.  
  84.   virtual void mark_in_parens (void) { in_parens++; }
  85.  
  86.   virtual bool is_in_parens (void) { return in_parens; }
  87.  
  88.   virtual void mark_for_possible_ans_assign (void);
  89.  
  90.   virtual octave_value eval (bool print) = 0;
  91.  
  92.   virtual char *oper (void) const { return "<unknown>"; }
  93.  
  94.   virtual string original_text (void) const;
  95.  
  96. protected:
  97.  
  98.   // Nonzero if this expression appears inside parentheses.
  99.   int in_parens;
  100.  
  101.   // The type of this expression.
  102.   type etype;
  103. };
  104.  
  105. #endif
  106.  
  107. /*
  108. ;;; Local Variables: ***
  109. ;;; mode: C++ ***
  110. ;;; End: ***
  111. */
  112.